package zx.x.modules.yshbms.controller;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import zx.x.common.utils.R;

import zx.x.modules.yshapp.vo.Order2Vo;
import zx.x.modules.yshapp.vo.RaffleSingUpUserVo;
import zx.x.modules.yshbms.service.OrderService;

import java.util.List;


/**
 *
 * @author x
 * @email x
 */
@RestController
@RequestMapping("yshbms/order")
public class Order2Controller {
    @Autowired
    private OrderService orderService;

    @RequestMapping("/list")
    public R list(Order2Vo vo) {
        Page page = PageHelper.startPage(vo.getPage(), vo.getLimit());
        return R.ok().put("page", orderService.orderList(vo))
                .put("pages", page.getPages()).put("total", page.getTotal());
    }

    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id) {
        Order2Vo vo = orderService.getInfo(id);

        return R.ok().put("order2Vo", vo);
    }

}
